<?php

	/*Pagina do Gerenciamento onde os dados dos usuarios sao visualizados.*/

	session_start();
	include("/var/www/html/vivencias/conexaoBD.php");
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Experi&ecirc;ncias do Processo de Adoecimento</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="vivencias.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body onLoad="MM_preloadImages('imagens/stt_banco2.jpg','imagens/stt_relator2.jpg','imagens/stt_estat2.jpg','imagens/stt_definI2.jpg','imagens/sstt_inserirP2.jpg','imagens/sstt_tutores2.jpg','imagens/sstt_professores2.jpg','imagens/sstt_visitantes2.jpg','imagens/sstt_alunos2.jpg')">
<div align="center">
  <table width="1000" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="10%" align="left" valign="top"><img src="imagens/logo.jpg" width="66" height="53"></td>
                  <td width="90%"><img src="imagens/tit1.jpg" width="612" height="28"></td>
                </tr>
              </table></td>
          </tr>
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr align="left" valign="middle">
                  <td colspan="3" class="nomecurso"><?php echo $_SESSION['nomeCurso'];?></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td><a href="index.php"><img src="imagens/sair.gif" width="33" height="19" border="0"></a></td>
                </tr>
                <tr align="left" valign="middle">
                  <td width="25%">&nbsp;</td>
                  <td width="22%">&nbsp;</td>
                  <td width="52%">&nbsp;</td>
                  <td width="0%">&nbsp;</td>
                  <td width="0%">&nbsp;</td>
                  <td width="1%">&nbsp;</td>
                </tr>
              </table></td>
          </tr>
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr align="left" valign="top">
                  <td width="2%" background="imagens/bar_fnd_8.jpg" bgcolor="EBF4F9"><a href="relatorios.htm"><img src="imagens/mn_8.jpg" width="23" height="161" border="0"></a></td>
                  <td width="60%" align="center" bgcolor="f4f1fc">
                    <table width="816" border="0" cellpadding="0" cellspacing="0">
                      <tr align="left" valign="top">
                        <td width="10"><img src="imagens/pix_cor7b.gif" width="10" height="5"></td>
                        <td width="73"><img src="imagens/stt_cadastro2.jpg" width="73" height="21"></td>
                        <td width="10"><img src="imagens/pix_cor7b.gif" width="10" height="5"></td>
                        <td width="52"><a href="bancoG.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('banco','','imagens/stt_banco2.jpg',1)"><img src="imagens/stt_banco1.jpg" name="banco" width="52" height="21" border="0"></a></td>
                        <td width="10"><img src="imagens/pix_cor7b.gif" width="10" height="5"></td>
                        <td width="81"><a href="relatorios.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('relatorios','','imagens/stt_relator2.jpg',1)"><img src="imagens/stt_relator1.jpg" name="relatorios" width="81" height="21" border="0"></a></td>
                        <td width="10"><img src="imagens/pix_cor7b.gif" width="10" height="5"></td>
                        <td width="86"><a href="correcao.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('exercicios','','imagens/stt_correcao2.jpg',1)"><img src="imagens/stt_correcao1.jpg" name="exercicios" width="81" height="21" border="0"></a></td>
                        <td width="1"><img src="imagens/pix_cor7b.gif" width="10" height="5"></td>
                        <td width="116"><a href="d.comunica.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('definicoesiniciais','','imagens/stt_definI2.jpg',1)"><img src="imagens/stt_definI1.jpg" name="definicoesiniciais" width="140" height="21" border="0"></a></td>
                        <td width="117"><img src="imagens/pix_cor7b.gif" width="84" height="5"></td>
                      </tr>
                      <tr align="center" valign="top">
                        <td colspan="11"><img src="imagens/pix_cor8c.gif" width="810" height="2"></td>
                      </tr>
                      <tr align="left" valign="top">
                        <td colspan="11"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                              <td width="0%"><img src="imagens/pix_cor7b.gif" width="3" height="5"></td>
                              <td width="26%"><a href="inserir.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('inserirpartic','','imagens/sstt_inserirP2.jpg',1)"><img src="imagens/sstt_inserirP1.jpg" name="inserirpartic" width="160" height="20" border="0"></a></td>
                              <td width="0%"><img src="imagens/pix_cor7b.gif" width="3" height="5"></td>
                              <td width="9%"><a href="listagemAlunos.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('alunos','','imagens/sstt_alunos2.jpg',1)"><img src="imagens/sstt_alunos1.jpg" name="alunos" width="61" height="20" border="0"></a></td>
                              <td width="1%"><img src="imagens/pix_cor7b.gif" width="3" height="5"></td>
                              <td width="14%"><img src="imagens/sstt_pacientes2.jpg" width="80" height="20"></td>
                              <td width="0%"><img src="imagens/pix_cor7b.gif" width="3" height="5"></td>
                              <td width="9%"><a href="listagemTutores.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('tutores','','imagens/sstt_tutores2.jpg',1)"><img src="imagens/sstt_tutores1.jpg" name="tutores" width="62" height="20" border="0"></a></td>
                              <td width="0%"><img src="imagens/pix_cor7b.gif" width="3" height="5"></td>
                              <td width="15%"><a href="listagemProfessores.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('professores','','imagens/sstt_professores2.jpg',1)"><img src="imagens/sstt_professores1.jpg" name="professores" width="96" height="20" border="0"></a></td>
                              <td width="0%"><img src="imagens/pix_cor7b.gif" width="3" height="5"></td>
                              <td width="13%"><a href="listagemVisitantes.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('visitantes','','imagens/sstt_visitantes2.jpg',1)"><img src="imagens/sstt_visitantes1.jpg" name="visitantes" width="83" height="20" border="0"></a></td>
                              <td width="0%"><img src="imagens/pix_cor7b.gif" width="6" height="5"></td>
                              <td width="0%">&nbsp;</td>
                              <td width="0%">&nbsp;</td>
                              <td width="13%">&nbsp;</td>
                            </tr>
                          </table></td>
                      </tr>
                    </table>
                    <table width="95%" border="0" cellpadding="5" cellspacing="1">
                      <tr>
                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <td align="center" bgcolor="ddd9e9" class="titprincipal"><table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#FFFFFF">
                            <tr>
                              <td bgcolor="9786c6" class="ativomenor">Listagem
                                dos PACIENTES participantes</td>
                            </tr>

 			   <!-- Inicio do codigo php para exibir os dados do paciente desejado -->

			   <?php
			   	$idUsuario  = $_GET["idUsuario"];
			        $query1     = "SELECT * FROM usuarios WHERE idUsuario=$idUsuario";
			        $resultado1 = mysql_query($query1,$conexao);
			        $objeto1    = mysql_fetch_object($resultado1);

			   ?>
                            <tr>
                              <td bgcolor="ddd9e9" class="texto2"><table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#FFFFFF">
                                  <tr bgcolor="#38708F" class="texttab">
                                    <td width="6%" align="left" valign="top" bgcolor="9786c6"><div align="left" class="branco"><a href="listagemPacientes.php"><img src="imagens/x.jpg" width="21" height="21" border="0"></a></div></td>
                                    <td width="21%" align="right" valign="top" bgcolor="9786c6" class="texto">Nome</td>
                                    <td width="2%" bgcolor="9786c6">&nbsp;</td>
                                    <td colspan="2" bgcolor="9786c6" class="texto">
                                      <?php echo $objeto1->nome;?></td>
                                  </tr>
                                  <tr bgcolor="ddd9e9" class="texttab">
                                    <td colspan="2" align="right" valign="middle" class="texto">Telefone</td>
                                    <td valign="top">&nbsp;</td>
                                    <td colspan="2" valign="middle" class="texto"><?php echo $objeto1->telefone;?></td>
                                  </tr>
                                  <tr bgcolor="ddd9e9" class="texttab">
                                    <td colspan="2" align="right" valign="middle" class="texto">E-mail</td>
                                    <td valign="top">&nbsp;</td>
                                    <td colspan="2" valign="middle" class="texto"><?php echo $objeto1->email;?>
                                    </td>
                                  </tr>
                                  <tr bgcolor="a99ec6" class="texttab">
                                    <td colspan="2" align="right" valign="middle" class="texto">Grupo
                                      de trabalho</td>
                                    <td valign="top">&nbsp;</td>
                                    <td colspan="2" valign="middle" class="texto">
                                      <table width="100%" border="0">
                                        <tr>
                                          <?php
						/*Seleciona o grupo da pessoa*/

						$queryGrupo     = "SELECT grupo FROM usuariosCursos WHERE idCurso='".$_SESSION['idCurso']."' AND idUsuario='".$idUsuario."'";
						$resultadoGrupo = mysql_query($queryGrupo,$conexao);
						$objetoGrupo    = mysql_fetch_object($resultadoGrupo);
						if(!$objetoGrupo->grupo){
							$grupo = 'Sem Grupo';
						}else{
							$grupo = "Grupo" . " " . $objetoGrupo->grupo;
						}
					?>
                                          <td width="26%" align="left" valign="middle" class="texto"><?php echo $grupo; ?>
                                             </td>

					  <form action="modificaTipoCadastro.php" method="post">
                                          <td width="74%" align="right" valign="middle"><span class="texto2">Mudar
                                            grupo: </span>
					   <input type="hidden" name="idUsuario" value="<?php echo $idUsuario;?>">
					   <input type="hidden" name="idTipoUsuario" value="3">
					    <select name="grupo" size="1">
                                             <option value="0">Sem Grupo</option>
					      <?php
							$queryQtdGrupos     = "SELECT qtdGrupos FROM cursos WHERE idCurso=".$_SESSION['idCurso'];
							$resultadoQtdGrupos = mysql_query($queryQtdGrupos,$conexao);
							$objetoQtdGrupos    = mysql_fetch_object($resultadoQtdGrupos);
							for($i = 1;$i <= $objetoQtdGrupos->qtdGrupos;$i++){

					      ?>
                                              <option value="<?php echo $i;?>"<?php if($objetoGrupo->grupo == $i){ echo "selected";}?>>Grupo <?php echo $i;?></option>
                                              <?php } ?>
                                            </select> <input type="submit" name="atualizaGrupo" value="Enviar">
                                          </td>
					  </form>
                                        </tr>
                                      </table></td>
                                  </tr>
                                  <tr bgcolor="a99ec6" class="texttab">
                                    <td colspan="2" valign="middle" bgcolor="a99ec6">
                                      <div align="right">
                                        <p class="texto">Tipo de Login</p>
                                      </div></td>
                                    <td valign="top">&nbsp;</td>
                                    <td colspan="2" valign="middle" class="texto">
                                      <table width="100%" border="0">
                                        <tr>
					 <form action="modificaTipoCadastro.php" method="post">
					 <input type="hidden" name="idUsuario" value="<?php echo $idUsuario;?>">
                                          <td align="left" valign="middle" class="texto">Paciente</td>
                                          <td align="right" valign="middle"><span class="texto2">Mudar
                                            login: </span> <select name="idTipoUsuario" size="1">
                                              <option value="3">Paciente</option>
                                              <option value="2">Aluno</option>
                                              <option value="0">Professor</option>
                                              <option value="1">Tutor</option>
                                              <option value="4">Visitante</option>
                                            </select> <input type="submit" name="atualizaTC" value="Enviar">
                                          </td>
					  </form>
                                        </tr>
                                      </table></td>
                                  </tr>
				  <?php
				  	/*Verificando se o usuario possui blog*/
					$query = "SELECT idBlog FROM blogs WHERE idUsuario='".$idUsuario."' AND idCurso='".$_SESSION['idCurso']."'";
					$resultado  = mysql_query($query,$conexao);
					$objeto     = mysql_fetch_object($resultado);
					$num_result = mysql_num_rows($resultado);

				  ?>
                                  <tr bgcolor="a99ec6" class="texto">
                                    <td height="29" colspan="2" align="right" valign="middle">Ir
                                      para</td>
                                    <td valign="top">&nbsp;</td>
                                    <td colspan="2" align="left" valign="middle">
                                      <?php if($num_result){ ?>
                                      <a href="blogPosts.php?idBlog=<?php echo $objeto->idBlog;?>" class="texto2"><input type="button" name="button1" value="Blog"></a>
				      <?php } ?>
                                      <a href="pagPessoalPac.php?idUsuario=<?php echo $idUsuario;?>" class="texto2"><input type="button" name="button4" value="P&aacute;gina Pessoal"></a>
                                    </td>
                                  </tr>
                                  <tr bgcolor="ddd9e9" class="texttab">
                                    <td colspan="2" valign="middle" bgcolor="ddd9e9">
                                      <div align="right">
                                        <p class="texto">Nascimento</p>
                                      </div></td>
                                    <td>&nbsp;</td>
                                    <td width="41%" valign="middle" class="texto"><?php echo $nascimento = ereg_replace("([0-9]{2}([0-9]{2})?)[/.-]([01]?[0-9])[/.-]([0123]?[0-9])","\\4-\\3-\\1",$objeto1->nascimento);?></td>
                                    <td width="30%" rowspan="6" align="center" valign="middle" class="texto"><img src= "<? echo $objeto1->foto; ?>"  style="<?php $tamanhoImagem = getimagesize("http://localhost" . $objeto1->foto); if($tamanhoImagem[0] > $tamanhoImagem[1] && $tamanhoImagem[0] > 150) echo "width:150px; height:auto;"; else if($tamanhoImagem[1]>200 && ($tamanhoImagem[1]/$tamanhoImagem[0]) >= (200/150)) echo "height:200px; width:auto;";else if($tamanhoImagem[0]>150 && ($tamanhoImagem[1]/$tamanhoImagem[0]) <= (200/150)) echo "width: 150px; height:auto;"; ?>"></td>
                                  </tr>
                                  <tr bgcolor="ddd9e9" class="texttab">
                                    <td colspan="2" valign="middle"> <div align="right">
                                        <p class="texto">Sexo</p>
                                      </div></td>
                                    <td>&nbsp;</td>
                                    <td valign="middle" bgcolor="ddd9e9" class="texto"><?php echo $objeto1->sexo;?>
                                    </td>
                                  </tr>
                                  <tr bgcolor="ddd9e9" class="texttab">
                                    <td colspan="2" align="right" valign="middle" class="texto">Endere&ccedil;o</td>
                                    <td>&nbsp;</td>
                                    <td valign="middle" class="texto"><?php echo $objeto1->endereco;?></td>
                                  </tr>
                                  <tr bgcolor="ddd9e9" class="texttab">
                                    <td colspan="2" valign="middle" class="texto"><div align="right">Cidade</div></td>
                                    <td valign="top">&nbsp;</td>
                                    <td valign="middle" bgcolor="ddd9e9" class="texto"><?php echo $objeto1->cidade;?></td>
                                  </tr>
                                  <tr bgcolor="ddd9e9" class="texttab">
                                    <td colspan="2" valign="middle"> <div align="right">
                                        <p class="texto">Estado</p>
                                      </div></td>
                                    <td>&nbsp;</td>
                                    <td valign="middle" class="texto"><?php echo $objeto1->estado;?></td>
                                  </tr>
                                  <tr bgcolor="ddd9e9" class="texttab">
                                    <td colspan="2" valign="middle"> <div align="right">
                                        <p class="texto">Profiss&atilde;o</p>
                                      </div></td>
                                    <td>&nbsp;</td>
                                    <td valign="middle" class="texto"><?php echo $objeto1->profissao;?></td>
                                  </tr>
                                  <!--<tr bgcolor="ddd9e9" class="texttab">
                                    <td colspan="2" align="right" valign="middle" class="texto">V&iacute;nculo
                                      profissional</td>
                                    <td>&nbsp;</td>
                                    <td valign="middle" class="texto"><?php echo $objeto1->vinculoProfissional;?></td>
                                    <td align="center" valign="middle" class="texto">&nbsp;</td>
                                  </tr>-->
                                </table></td>
                            </tr>
                           <!-- <tr>
                              <td bgcolor="ddd9e9" class="texto2"><strong>Miriam
                                Struchiner</strong></td>
                            </tr>
                            <tr>
                              <td bgcolor="ddd9e9" class="texto2"><strong>Outro
                                paciente..</strong></td>
                            </tr>-->
                          </table></td>
                      </tr>
                    </table>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p></td>
                  <td width="0%" align="right" background="imagens/bar_fnd_7.jpg"><a href="info.php"><img src="imagens/mn_7.jpg" width="23" height="137" border="0"></a>
                  </td>
                  <td width="8%" align="right" background="imagens/bar_fnd_6.jpg"><a href="esppess.php"><img src="imagens/mn_6.jpg" width="23" height="156" border="0"></a>
                  </td>
                  <td width="4%" align="right" background="imagens/bar_fnd_5.jpg"><a href="comunicacao.php"><img src="imagens/mn_5.jpg" width="23" height="146" border="0"></a>
                  </td>
                  <td width="5%" align="right" background="imagens/bar_fnd_4.jpg"><a href="banco.php"><img src="imagens/mn_4.jpg" width="23" height="219" border="0"></a>
                  </td>
                  <td width="4%" align="right" background="imagens/bar_fnd_3.jpg"><a href="ferramentasTrabalho.php"><img src="imagens/mn_3.jpg" width="23" height="249" border="0"></a>
                  </td>
                  <td width="2%" align="right" background="imagens/bar_fnd_2.jpg"><a href="conteudo.php"><img src="imagens/mn_2.jpg" width="23" height="113" border="0"></a></td>
                  <td width="15%" align="right" background="imagens/bar_fnd_1.jpg" bgcolor="F1FEF9">
                    <p><a href="principal.php"><img src="imagens/mn_1.jpg" width="23" height="103" border="0"></a></p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p></td>
                </tr>
              </table></td>
          </tr>
        </table></td>
    </tr>
  </table>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
</div>
</body>
</html>
